<template>
  <div>
     <!--城市选择头部-->
    <city-header></city-header>
    <!--城市搜索-->
    <city-search :cities="cities"></city-search>
    <!--城市列表-->
    <city-list :cities="cities" :hot="hotCities" :le="le"></city-list>
    <!--字母列表-->
    <list-alphabet
      :cities="cities"
      @change="changeLetter"
    ></list-alphabet>
  </div>
</template>
<script>
import CityHeader from './component/cityHeader'
import CitySearch from './component/citySearch'
import CityList from './component/cityList'
import ListAlphabet from './component/listAlphabet'
export default {
  name: 'City',
  components: {
    CityHeader,
    CitySearch,
    CityList,
    ListAlphabet
  },
  data () {
    return {
      cities: {},
      hotCities: [],
      le: ''
    }
  },
  methods: {
    getCityInfo () {
      this.$http.get('./static/message/city.json').then(this.getCityInfoSucc)
    },
    getCityInfoSucc (res) {
      var body = res.data
      if (body.ret && body.data) {
        const data = body.data
        this.cities = data.cities
        this.hotCities = data.hotCities
      }
    },
    changeLetter (le) {
      this.le = le
    }
  },
  mounted () {
    this.getCityInfo()
  }
}
</script>
<style>

</style>
